﻿<!--
Majesty of Omega - The next evolution of macro management space strategy

Copyright 2007 André Claaßen

This file is protected by the terms and conditions of the
Microsoft Community License (Ms-CL 1.1), a copy of which should
have been distributed along with this software. If not,
you may find the license information at the following URL:

http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx
-->
    
<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:Generator="clr-namespace:Majesty_of_Omega.Logic.Generator;assembly=Majesty_of_Omega_BL"
	xmlns:ValueConverters="clr-namespace:Majesty_of_Omega.GUI.ValueConverters"
	mc:Ignorable="d"
	x:Class="Majesty_of_Omega.GUI.Pages.Parts.SaveGameEntryPart"
	x:Name="UserControl"
	d:DesignWidth="357.6" d:DesignHeight="54.4" RenderTransformOrigin="0.5,0.5">
	<UserControl.Resources>
        
        <ObjectDataProvider x:Key="TestDataGeneratorDS" ObjectType="{x:Type Generator:TestDataGenerator}" />
        <ValueConverters:FormattingStringConverter x:Key="FormattingStringConverter"/>

        <Style x:Key="SaveGameBorderStyle" TargetType="{x:Type Border}">
        	<Style.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                    <Setter Property="Background" Value="Orange" />
                </Trigger>
        	</Style.Triggers>
			<Setter Property="BorderBrush" Value="#FFFFFFFF"/>
			<Setter Property="BorderThickness" Value="1,1,1,1"/>
			<Setter Property="Padding" Value="8,4,8,4"/>
			<Setter Property="Background" Value="{DynamicResource PanelBackgroundBrush}"/>
		</Style>

		<Style x:Key="SaveGameEntryStyle" TargetType="{x:Type TextBlock}">
			<Setter Property="TextWrapping" Value="NoWrap"/>
			<Setter Property="TextTrimming" Value="None"/>
			<Setter Property="RenderTransform">
				<Setter.Value>
					<SkewTransform AngleX="8" AngleY="0"/>
				</Setter.Value>
			</Setter>
			<Setter Property="Foreground" Value="#FFFFFFFF"/>
		</Style>
	</UserControl.Resources>
	<UserControl.RenderTransform>
		<TransformGroup>
			<ScaleTransform ScaleX="1" ScaleY="1"/>
			<SkewTransform AngleX="0" AngleY="0"/>
			<RotateTransform Angle="0"/>
			<TranslateTransform X="0" Y="0"/>
		</TransformGroup>
	</UserControl.RenderTransform>
	<UserControl.Triggers>
        <EventTrigger RoutedEvent="UserControl.Loaded">
            <BeginStoryboard >
                <BeginStoryboard.Storyboard>
                    <Storyboard>
                        <DoubleAnimationUsingKeyFrames x:Name="MotionAnimationLoaded" BeginTime="00:00:00" Duration="00:00:02" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-1000" KeySpline="0,0.008,0.653,1"/>
                            <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0" KeySpline="0,0.008,0.653,1"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:01" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(UIElement.Opacity)">
                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                            <SplineDoubleKeyFrame KeyTime="00:00:01" Value="100" />
                        </DoubleAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Hidden}"/>
                            <DiscreteObjectKeyFrame KeyTime="00:00:00.1000000" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </BeginStoryboard.Storyboard>
            </BeginStoryboard>
        </EventTrigger>
        <EventTrigger RoutedEvent="UserControl.Unloaded">
            <BeginStoryboard >
                <BeginStoryboard.Storyboard>
                    <Storyboard x:Name="UnloadAnimationStoryBoard">
                        <DoubleAnimationUsingKeyFrames x:Name="MotionAnimationUnloaded" BeginTime="00:00:00" Duration="00:00:02" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0" />
                            <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:01" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(UIElement.Opacity)">
                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                            <SplineDoubleKeyFrame KeyTime="00:00:01" Value="100" />
                        </DoubleAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Hidden}"/>
                            <DiscreteObjectKeyFrame KeyTime="00:00:00.1000000" Value="{x:Static Visibility.Visible}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </BeginStoryboard.Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </UserControl.Triggers>

	<Border x:Name="EntryBorder" Style="{DynamicResource SaveGameBorderStyle}" Margin="6,6,6,6" CornerRadius="16,0,16,0" MouseLeftButtonUp="EntryBorder_MouseLeftButtonUp" >
        <Grid x:Name="EntryGrid" DataContext="{Binding Path=TestSaveGameInfo, Source={StaticResource TestDataGeneratorDS}}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.4*"/>
                <ColumnDefinition Width="0.3*"/>
                <ColumnDefinition Width="0.3*"/>
                <ColumnDefinition Width="0.2*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Path=GameName}" TextWrapping="Wrap" Grid.Column="0" Style="{DynamicResource SaveGameEntryStyle}" FontWeight="Bold" />
			<TextBlock Text="{Binding Path=RaceName}" TextWrapping="Wrap" Grid.Column="1" Style="{DynamicResource SaveGameEntryStyle}" />
			<TextBlock Text="{Binding Path=TurnNumber}" TextWrapping="Wrap" Grid.Column="2" Style="{DynamicResource SaveGameEntryStyle}" />
			<TextBlock Text="{Binding Path=Time, 
                Converter={StaticResource FormattingStringConverter}, ConverterParameter=' \{0:dd-MMM-yyyy hh:mm\}'}" 
				TextWrapping="Wrap" Grid.Column="3" HorizontalAlignment="Stretch" Width="120" TextAlignment="Right" 
				Style="{DynamicResource SaveGameEntryStyle}" 
					/>
			<TextBlock x:Name="EmptyTypeTextBlock" Visibility="Hidden" HorizontalAlignment="Center" Grid.ColumnSpan="4" Style="{DynamicResource SaveGameEntryStyle}" />
        </Grid>
    </Border>
</UserControl>